; r1 = i
; r2 = j
; r3 = temp
add r4, r0, r0	; r4 = var
addi	r5, r0, 4		//size of matrix (box)
add r6, r0, r0
li	r6, 20	//base address of A
add r7, r0, r0
li	r7, 100	//base address of B
add r8, r0, r0
li	r8, 120	//base address of C
		
addi	r1, r0, 0		//init i=0
begina:
sub r15, r5, r1	
bez r15, endloopa		//if i>=box goto loopa
blz r15, endloopa
	
	addi	r2, r0, 0		//j=0
	beginb:	
	sub r15, r5, r2	
	bez r15, endloopb	//if j>=box goto loopb
	blz r15, endloopb
	
		mul r15, r1, r5
		add r15, r15, r2
		add r14, r15, r6
		store r1, 0(r14)
		add r14, r15, r7
		store r2, 0(r14)

		addi	r2, r2, 1		//j++
		bez r0, beginb			//start loopb again
	endloopb:	
	
	addi	r1, r1, 1		//i++
	bez r0, begina			//start loopa again
endloopa:	



addi	r1, r0, 0		//init i=0
loop1:
sub r15, r5, r1	
bez r15, endloop1		//if i>=box goto loopa
blz r15, endloop1
	
	addi	r2, r0, 0		//j=0
	loop2:	
	sub r15, r5, r2	
	bez r15, endloop2	//if j>=box goto loopb
	blz r15, endloop2
	
		add r4, r0, r0		//var = 0

		addi	r3, r0, 0		//temp=0
		loop3:	
		sub r15, r5, r3	
		bez r15, endloop3	//if temp>=box goto loop3end
		blz r15, endloop3

			mul r15, r1, r5
			add r15, r15, r3
			add r14, r15, r6
			load r10, 0(r14) // A[i][temp]

			mul r15, r3, r5
			add r15, r15, r2
			add r14, r15, r7
			load r11, 0(r14) // B[temp][j]

			mul r10, r10, r11

			add r4, r4, r10		//var = var + r10*r11

			addi	r3, r3, 1		//temp++
			bez r0, loop3			//start loop3 again
		endloop3:	

		mul r15, r1, r5
		add r15, r15, r2
		add r14, r15, r8
		store r4, 0(r14)	//C[i][j] = var

		addi	r2, r2, 1		//j++
		bez r0, loop2			//start loopb again

	endloop2:	
	
	addi	r1, r1, 1		//i++
	bez r0, loop1			//start loopa again
endloop1:	







